import type  VTable from "./VTable.vue";

import { ref } from "vue";

export function useTable() {
  const tableRef = ref<InstanceType<typeof VTable>>();

  // 常用表格方法

  // 获取选中行
  const getSelectionRows = () => {
    return tableRef.value?.getSelectionRows();
  };

  // 刷新表格
  const reload = () => {
    tableRef.value?.reload();
  };

  // 重置表格 
  const reset = () => {
    tableRef.value?.reset();
    tableRef.value?.clearSort();
  };
  

  return {
    tableRef,
    getSelectionRows,
    reload,
    reset
  }
}